﻿using System;
using System.Collections.Generic;

namespace ExpressesClass.Method
{
    public class LambdaComparer<T> : IComparer<T>
    {
        private readonly Func<T, T, int> _lambdaComparer;
        public LambdaComparer(Func<T, T, int> lambdaComparer)
        {
            if (lambdaComparer == null)
            {
                throw new ArgumentNullException("lambdaComparer");
            }

            _lambdaComparer = lambdaComparer;
        }
        public int Compare(T x, T y)
        {
            return _lambdaComparer(x, y);
        }
    }
}
